build: Check for sincosf()
authorChun-wei Fan <fanchunwei@src.gnome.org>
Wed, 8 Jan 2020 09:05:44 +0000 (17:05 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Wed, 8 Jan 2020 09:15:29 +0000 (17:15 +0800)
sincosf() is really a GCC-specific function that may more may not be
supported on non-GCC compilers, so we want to check for it, otherwise we
use a fallback implementation, not unlike the one in
demos/gtk-demo/gtkgears.c.

gsk/gsktransform.c
meson.build

index 3f944db9ea31b24ad21c57c9d5bd971794d7e734..388dad5b45366dcae957064b621c726142c191b8 100644 (file)
@@ -712,7 +712,15 @@ _sincos (float  deg,
     }
   else
     {
-      sincosf (deg * M_PI / 180.0, out_s, out_c);
+      float angle = deg * M_PI / 180.0;
+
+#ifdef HAVE_SINCOSF
+      sincosf (angle, out_s, out_c);
+#else
+      *out_s = sinf (angle);
+      *out_c = cosf (angle);
+#endif
+
     }
 }
 
index c07ae0340e3d8969c69bafa0a0eb3b1127fae336..22a211c4fcb876af9de41e2b10c066f443051573 100644 (file)
@@ -198,6 +198,7 @@ check_functions = [
   'log2',
   'exp2',
   'sincos',
+  'sincosf',
 ]
 
 foreach func : check_functions